<template>
	<view class="pinOrder">
		<view class="pinOrder_one">
			<view class="one_title" :class="{'one_titleActive':pinIndex==indexs}" v-for="(items,indexs) in pinNav"
				@click="pinIndex=indexs,page=1,gettuOrder('init')">
				{{items}}
				<view class="one_title_line" v-if="indexs==pinIndex">

				</view>
			</view>
		</view>
		<view class="pinOrder_count">
			<view class="count_one" v-for="(itemed,indexed) in orderlist" :key="indexed">
				<view class="count_one_title">
					订单号：
					<view class="title_right">
						{{itemed.order_no}}
					</view>
				</view>
				<view class="count_one_time">
					<view class="one_time_left">
						收益倍数：{{itemed.weigh}}
					</view>
					<view class="one_time_right">
						{{itemed.status==0?'未结算':'已结算'}}
					</view>
				</view>
				<view class="count_one_price">
					确认值：{{itemed.kdj}} 
				</view>
				<view class="jindu_title">
					奖励发放：<button style="margin-bottom: 0;border: none;background-color: #fe6600;color: #ffffff;width: 70px;
    font-size: 12px;
    height: 30px;"
						>领取</button>
				</view>
				<view class="jindu_title">
					下单时间：{{itemed.createtime}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pinNav: ['未结算', '已结算'],
				pinIndex: 0,
				page: 1,
				last_page: 1,
				orderlist: [],
			}
		},
		onLoad() {
			this.gettuOrder('init')
		},
		onPullDownRefresh() {
			setTimeout(()=>{
				uni.stopPullDownRefresh()
			},1500)
			this.gettuOrder('init')
		},
		onReachBottom() {
			if(this.last_page>this.page){
				this.page++
				this.gettuOrder()
			}
		},
		methods: {
			async gettuOrder(type) {
				if (type == 'init') {
					this.page = 1
					this.orderlist = []
				}
				await uni.request({
					url: "/wanlshop/Signin/tu_order_list",
					method: "POST",
					data: {
						page: this.page,
						status: this.pinIndex
					},
					success: (res) => {
						this.last_page = res.data.last_page
						if (res.data.data.length) {
							if (this.page == 1) {
								this.orderlist = res.data.data
							} else {
								this.orderlist = [...this.orderlist, ...res.data.data]
							}
						}
						console.log(res.data, '拼图订单')
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pinOrder {
		width: 100%;

		.pinOrder_one {
			width: 100%;
			height: 90rpx;
			background: #FFFFFF;
			display: flex;
			position: sticky;
			left: 0;
			/* #ifdef H5 */
			top: 80rpx;
			/* #endif */
			/* #ifdef MP-WEIXIN */
			top: 0;
			/* #endif */
			.one_title {
				flex: 1;
				height: 90rpx;
				line-height: 90rpx;
				text-align: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #666666;
				position: relative;

				.one_title_line {
					width: 36rpx;
					height: 6rpx;
					background: #fe6600;
					border-radius: 3rpx;
					position: absolute;
					left: 45%;
					bottom: 4rpx;
				}
			}

			.one_titleActive {
				color: #fe6600;
			}
		}

		.pinOrder_count {
			width: 100%;
			box-sizing: border-box;
			padding: 20rpx 24rpx;

			.count_one {
				width: 100%;
				background-color: #FFFFFF;
				border-radius: 15rpx;
				box-sizing: border-box;
				padding: 20rpx 25rpx;
				margin-bottom: 20rpx;

				.count_one_title {
					font-size: 30rpx;
					color: #333333;
					font-weight: 8000;
					display: flex;
					align-items: center;
					.title_right{
						width: 525rpx;
						word-break: break-all;
						color: #666666;
						font-size: 28rpx;
						// margin-left: 10rpx;
					}
				}

				.count_one_time {
					width: 100%;
					display: flex;
					justify-content: space-between;
					margin-top: 25rpx;

					.one_time_left {
						font-size: 26rpx;
						color: #666666;
					}

					.one_time_right {
						font-size: 28rpx;
						color: #666666;
					}
				}

				.count_one_price {
					font-size: 26rpx;
					color: #666666;
					margin-top: 25rpx;

					span {
						margin-left: 40rpx;
					}
				}

				.jindu_title {
					font-size: 26rpx;
					color: #666666;
					margin-top: 25rpx;
				}
			}

		}
	}
</style>